"use strict";
module.exports = () => {
    const config = {
        presets: [
            [
                'react-app',
                {
                    absoluteRuntime: false,
                },
            ],
        ],
        plugins: [
            [
                'use-const-enum',
                {
                    importRegStr: 'choerodon-ui/.*/enum',
                },
            ],
            [
                'import',
                {
                    libraryName: 'cpaas-ui',
                    style: false,
                },
                'ant',
            ],
            [
                'import',
                {
                    libraryName: 'choerodon-ui',
                    style: false,
                },
                'c7n',
            ],
            [
                'import',
                {
                    libraryName: 'choerodon-ui/pro',
                    style: false,
                },
                'c7n-pro',
            ],
            [
                '@babel/plugin-proposal-decorators',
                {
                    legacy: true,
                },
            ],
            'lodash',
            [
                '@babel/plugin-proposal-class-properties',
                {
                    loose: true,
                },
            ],
            process.env.DISABLE_AUTO_CSS_MODULES !== 'true' && [
                require.resolve('@umijs/babel-plugin-auto-css-modules'),
                {
                    flag: 'modules',
                },
            ],
        ].filter(Boolean),
    };
    if (process.env.MULTIPLE_SKIN_ENABLE === 'true') {
        const { generateC7nUiConfig, generateCpaasUIConfig, } = require('@cpaas-front-ui/cfg/lib/utils/uedConfig');
        config.plugins = generateCpaasUIConfig()
            .concat(generateC7nUiConfig())
            .concat(config.plugins.filter(
        // @ts-ignore
        (arrs = []) => !['ant', 'c7n', 'c7n-pro'].includes(arrs[2])));
    }
    return config;
};
